import request from '@/utils/request'

// 查询次卡订单列表
export function listNumberCardOrder(query) {
  return request({
    url: '/finance/numbercard/list',
    method: 'get',
    params: query
  })
}

// 查询次卡订单详细
export function getNumberCardOrder(id) {
  return request({
    url: '/finance/numbercard/' + id,
    method: 'get'
  })
}

// 查询次卡关联项目列表
export function listNumberCardShopItems() {
  return request({
    url: '/finance/numbercard/shopItems',
    method: 'get'
  })
}

// 获取次卡关联项目详情
export function getNumberCardShopItem(id) {
  return request({
    url: '/finance/numbercard/shopItem/' + id,
    method: 'get'
  })
}

// 新增次卡订单
export function addNumberCardOrder(data) {
  return request({
    url: '/finance/numbercard',
    method: 'post',
    data: data
  })
}

// 修改次卡订单
export function updateNumberCardOrder(data) {
  return request({
    url: '/finance/numbercard',
    method: 'put',
    data: data
  })
}

// 删除次卡订单
export function delNumberCardOrder(id) {
  return request({
    url: '/finance/numbercard/' + id,
    method: 'delete'
  })
}

// 批量删除次卡订单
export function delBatchNumberCardOrder(ids) {
  return request({
    url: '/finance/numbercard/batch',
    method: 'delete',
    data: ids
  })
}

// 导出次卡订单
export function exportNumberCardOrder(query) {
  return request({
    url: '/finance/numbercard/export',
    method: 'get',
    params: query
  })
}

// 编辑次卡关联项目
export function updateNumberCardShopItem(id, data) {
  return request({
    url: '/finance/numbercard/shopItem/' + id,
    method: 'put',
    data: data
  })
}

// 批量编辑次卡关联项目
export function batchUpdateNumberCardShopItems(data) {
  return request({
    url: '/finance/numbercard/shopItems/batch',
    method: 'put',
    data: data
  })
}

// 绑定次卡与项目
export function bindNumberCardWithShopItem(data) {
  return request({
    url: '/finance/numbercard/shopItem/bind',
    method: 'post',
    data: data
  })
}

// 解绑次卡与项目
export function unbindNumberCardWithShopItem(cardId, shopItemId) {
  return request({
    url: '/finance/numbercard/shopItem/unbind',
    method: 'delete',
    params: { cardId, shopItemId }
  })
}